package com.wolfking.jeesite.condition;

import com.wolfking.jeesite.util.OsUtils;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.core.type.AnnotatedTypeMetadata;


@Order(Ordered.LOWEST_PRECEDENCE - 20)
class OnNotWindowsCondition extends SpringBootCondition {

    @Override
    public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
        boolean result = OsUtils.isNotWindows();
        return new ConditionOutcome(result,
                ConditionMessage.forCondition(ConditionalOnNotWindows.class, "非windows").resultedIn(result));
    }
}
